package com.practise;

import java.util.HashSet;
import java.util.Set;

//.判断一个int数组中的元素是否存在重复，方法声明如下：
//
//boolean isRepeat(int[] m){ }
public class PractiseDemo4 {
  /*  public static void main(String[] args) {
        int[] m = {1, 2, 3, 3, 2, 1};
        boolean repeat = isRepeat(m);
        System.out.println("repeat = " + repeat);
    }*/  //测试............

    public static boolean isRepeat(int[] m) {
        Set set = new HashSet();
        boolean flag = false;
        for (int i = 0; i < m.length; i++) {
            set.add(m[i]);
        }
        if (set.size() != m.length) {
            flag = true;
        } else {
        }
        return flag;
    }
}

